/* 
 * File:   Box2dDistanceJoint.cpp
 * Author: Elevator
 * 
 * Created on 25 Май 2013 г., 1:23
 */

#include "Box2dDistanceJoint.h"
#include "Box2D/Box2D.h"

namespace physics {

	Box2dDistanceJoint::Box2dDistanceJoint(
		Box2dBody* bodyA, Box2dBody* bodyB,
		b2DistanceJoint* joint )
	:
	_bodyA( bodyA ),
	_bodyB( bodyB ),
	_joint( joint ) {
	}

	Box2dDistanceJoint::~Box2dDistanceJoint( ) {
	}

	IBody* Box2dDistanceJoint::GetBodyA( ) const {
		return _bodyA;
	}

	IBody* Box2dDistanceJoint::GetBodyB( ) const {
		return _bodyB;
	}

	Vec2 Box2dDistanceJoint::GetAnchorA( ) const {
		b2Vec2 anchor = _joint->GetAnchorA( );
		return Vec2( anchor.x, anchor.y );
	}

	Vec2 Box2dDistanceJoint::GetAnchorB( ) const {
		b2Vec2 anchor = _joint->GetAnchorB( );
		return Vec2( anchor.x, anchor.y );
	}

	float Box2dDistanceJoint::GetLength( ) const {
		return _joint->GetLength( );
	}

	void Box2dDistanceJoint::SetLength( float value ) {
		_joint->SetLength( value );
	}

	float Box2dDistanceJoint::GetFrequency( ) const {
		return _joint->GetFrequency( );
	}

	void Box2dDistanceJoint::SetFrequency( float value ) {
		_joint->SetLength( value );
	}

	float Box2dDistanceJoint::GetDampingRatio( ) const {
		return _joint->GetDampingRatio( );
	}

	void Box2dDistanceJoint::SetDampingRatio( float value ) {
		_joint->SetDampingRatio( value );
	}

	b2DistanceJoint* Box2dDistanceJoint::GetBox2dJoint( ) {
		return _joint;
	}
}
